package com.mcy.business.fallback;

import com.mcy.business.feign.BootClient;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

/*@Component*/
@Slf4j
public class BootClientFallBack implements BootClient {

    private Throwable throwable;

    public BootClientFallBack(Throwable throwable) {
        this.throwable = throwable;
    }

    @Override
    public String merge(String userId, BigDecimal money) {
        log.error("boot系统熔断了！"+userId+"\t "+money);
        return "系统熔断了！"+userId+"\t "+money+"异常信息:"+throwable.getMessage();
    }

    @Override
    public String init(HttpServletRequest request) {
        log.error("boot系统熔断了！");
        return "系统熔断了！";
    }
}
